// 1.0 导入vue核心包
import Vue from 'vue';
// 2.0 导入App.vue的vue对象
import App from './App.vue';
// 3.0 将vue-router集成到这个项目中来
import vueRouter from 'vue-router';

import mint from 'mint-ui'
import vueResource from 'vue-resource'
Vue.use(vueRouter);
Vue.use(mint)       //将mint绑定到Vue对象上
Vue.use(vueResource) // 3.0.1 将vueRouter对象绑定到Vue对象上



//导入css样式
import 'mint-ui/lib/style.min.css'
import '../statics/mui/css/mui.css'
import '../statics/mui/css/icons-extra.css'
import '../statics/css/v1.css'

//  导入路由规则对应的组件对象
import home from './components/Home.vue';   //首页
import car from './components/shopcar/car.vue'; //购物车
import newslist from './components/news/newslist.vue'; //新闻列表
import newinfo from './components/news/newsinfo.vue'; //新闻资讯
import phonelist from './components/phone/phonelist.vue' //图片列表
import phoneinfo from './components/phone/phoneinfo.vue' //图片分享详情


//导入系统公共配置文件
import commons from './components/kits/commons.js'
Vue.prototype.$commons = commons;

//定义全局过滤器
import moment from 'moment';
Vue.filter('datafmt',function(input,stringfmt){
  return  moment(input).format(stringfmt)
})
//  定义路由规则
var router1 = new vueRouter({
  linkActiveClass:'mui-active',               
  routes:[
    {path:'',redirect:'/home'},
    {path:'/home',component:home}, 
    {path:'/shopcar',component:car},
    {path:'/news/newslist',component:newslist},
    {path:'/news/newsinfo/:id',component:newinfo},
    {path:'/phone/phonelist',component:phonelist},
    {path:'/phone/phoneinfo/:id',component:phoneinfo}
    ]
  });

//  利用Vue对象进行解析渲染
new Vue({
  el:'#app',
  // 使用路由对象实例
  router:router1,
  // render:function(create ){create(App)} //es5的写法
  render:c=>c(App)  // es6的函数写法 =>：goes to
});